﻿<?xml version="1.0" encoding="utf-8" ?>
<Recipe Name="CreateSolution" xmlns="http://schemas.microsoft.com/pag/gax-core" xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="Common/CommonTypeAliases.xml"
				xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(/gax:Types)" />
  <Caption>Creates a new 4Ward Prism Solution</Caption>
  <Description>Creates a new 4Ward Prism Solution</Description>
  <Arguments>
    <Argument Name="DocumentationUrl">
      <ValueProvider Type="Evaluator" Expression="ms-help://MS.VSCC.v90/MS.VSIPCC.v90/ms.practices.scsf.2008apr/SCSF/html/02-08-060-Add_Business_Module_Next_Steps.htm"/>
    </Argument>

    <!--Solution instance-->
    <Argument Name="CurrentSolution" Type="EnvDTE.Solution, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <Converter Type="SolutionConverter" />
      <ValueProvider Type="Evaluator" Expression="/"/>
    </Argument>

    <!--Application name from solution name-->
    <Argument Name="ApplicationName">
      <ValueProvider Type="Evaluator" Expression="$(CurrentSolution.Properties.Item('Name').Value)"/>
    </Argument>

    <!--Common folder paths-->
    <Argument Name="CurrentSolutionPath"  Type="System.String" Required="true">
      <ValueProvider Type="SolutionPathProvider"/>
    </Argument>
    <Argument Name="SourceFolder" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(CurrentSolutionPath)\Source" />
    </Argument>
    <Argument Name="ServerFolder" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(SourceFolder)\Server" />
    </Argument>
    <Argument Name="SilverlightFolder" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(SourceFolder)\Silverlight" />
    </Argument>
    <Argument Name="WpfFolder" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(SourceFolder)\Wpf" />
    </Argument>
    <Argument Name="WpfBinFolder" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(WpfFolder)\Bin" />
    </Argument>
    <Argument Name="SilverlightBinFolder" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(SilverlightFolder)\Bin" />
    </Argument>
    <Argument Name="SharedBinariesFolder" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(SourceFolder)\_SharedBinaries" />
    </Argument>
    <Argument Name="PrismBinariesFolderWpf" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(SharedBinariesFolder)\Prism" />
    </Argument>
    <Argument Name="PrismBinariesFolderSilverlight" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(PrismBinariesFolderWpf)\Silverlight" />
    </Argument>
    <Argument Name="MicrosoftBinariesFolder" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(SharedBinariesFolder)\Microsoft" />
    </Argument>
    <Argument Name="EntlibBinariesFolder" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(MicrosoftBinariesFolder)\Entlib" />
    </Argument>

    <!--Assembly names to be referenced-->
    <Argument Name="MicrosoftPracticesCompositeAssembly">
      <ValueProvider Type="Evaluator" Expression="Microsoft.Practices.Composite.dll" />
    </Argument>
    <Argument Name="MicrosoftPracticesCompositePresentationAssembly">
      <ValueProvider Type="Evaluator" Expression="Microsoft.Practices.Composite.Presentation.dll" />
    </Argument>
    <Argument Name="MicrosoftPracticesUnityExtensionsAssembly">
      <ValueProvider Type="Evaluator" Expression="Microsoft.Practices.Composite.UnityExtensions.dll" />
    </Argument>
    <Argument Name="MicrosoftPracticesServiceLocationAssembly">
      <ValueProvider Type="Evaluator" Expression="Microsoft.Practices.ServiceLocation.dll" />
    </Argument>
    <Argument Name="MicrosoftPracticesUnityAssemblyWpf">
      <ValueProvider Type="Evaluator" Expression="Microsoft.Practices.Unity.dll" />
    </Argument>
    <Argument Name="MicrosoftPracticesUnityAssemblySilverlight">
      <ValueProvider Type="Evaluator" Expression="Microsoft.Practices.Unity.Silverlight.dll" />
    </Argument>

    <!--Required Assemblies-->
    <Argument Name="BaseAssemblies" Required="true" Type="System.String">
      <ValueProvider Type="Evaluator" Expression="$(MicrosoftPracticesCompositeAssembly);$(MicrosoftPracticesCompositePresentationAssembly);$(MicrosoftPracticesUnityExtensionsAssembly);$(MicrosoftPracticesServiceLocationAssembly)" />
    </Argument>
    <Argument Name="PrismAssembliesWpf" Required="true" Type="System.String">
      <ValueProvider Type="Evaluator" Expression="$(BaseAssemblies);$(MicrosoftPracticesUnityAssemblyWpf)" />
    </Argument>
    <Argument Name="PrismAssembliesSilverlight" Required="true" Type="System.String">
      <ValueProvider Type="Evaluator" Expression="$(BaseAssemblies);$(MicrosoftPracticesUnityAssemblySilverlight)" />
    </Argument>

    <!--Arguments for CreateSolutionPage-->
    <Argument Name="RootNamespace" Required="true">
      <ValueProvider Type="Evaluator" Expression="$(ApplicationName)" />
    </Argument>
    <Argument Name="ShellProjectName" Required="true" />
    <Argument Name="InfrastructureProjectName" Required="true" />
    <Argument Name="ShellTestProjectName" Required="true" />
    <Argument Name="InfrastructureTestProjectName" Required="true" />
    <Argument Name="PrismAssembliesPathWpf" Required="true" />
    <Argument Name="PrismAssembliesPathSilverlight" Required="true" />
    <Argument Name="EntlibAssembliesPath" Required="true" />

    <!--Project instances-->
    <Argument Name="ShellProjectWpf" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="ProjectByPathExpressionProvider" PathExpression="Source\Wpf\Source\$(ShellProjectName)" Stage="OnBeforeActions" />
    </Argument>
    <Argument Name="InfrastructureProjectWpf" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="ProjectByPathExpressionProvider" PathExpression="Source\Wpf\Source\$(InfrastructureProjectName)" Stage="OnBeforeActions"/>
    </Argument>
    <Argument Name="ShellTestProjectWpf" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="ProjectByPathExpressionProvider" PathExpression="Source\Wpf\Source\$(ShellTestProjectName)" Stage="OnBeforeActions" />
    </Argument>
    <Argument Name="InfrastructureTestProjectWpf" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="ProjectByPathExpressionProvider" PathExpression="Source\Wpf\Source\$(InfrastructureTestProjectName)" Stage="OnBeforeActions"/>
    </Argument>

  </Arguments>
  <GatheringServiceData>
    <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0" Help="ms-help://MS.VSCC.v90/MS.VSIPCC.v90/ms.practices.scsf.2008apr/SCSF/html/03-01-010-How_to_Create_Smart_Client_Solutions.htm">
      <Pages>
        <Page Type="PrismFactory.SoftwareFactory.CustomWizardPages.CreateSolution.CollectRootNamespacePage, PrismGuidancePackage" Height="450" Width="600">
          <Title>Collect Root namespace</Title>
          <LinkTitle>Collect Root namespace</LinkTitle>
        </Page>
        <Page Type="PrismFactory.SoftwareFactory.CustomWizardPages.CreateSolution.EnsurePrismAssembliesPage, PrismGuidancePackage" Height="450" Width="600">
          <Title>Ensure Prism assemblies</Title>
          <LinkTitle>Ensure Prism assemblies</LinkTitle>
        </Page>
        <Page Type="PrismFactory.SoftwareFactory.CustomWizardPages.CreateSolution.EnsureEntlibAssembliesPathPage, PrismGuidancePackage" Height="450" Width="600">
          <Title>Ensure Entlib assemblies path</Title>
          <LinkTitle>Ensure Entlib assemblies path</LinkTitle>
        </Page>
      </Pages>
    </Wizard>
  </GatheringServiceData>
  <Actions>

    <!-- Creates Bin folders-->
    <Action Name="CreateWpfBinFolder" Type="CreateFolderAction">
      <Input Name="FullPath" RecipeArgument="WpfBinFolder"/>
    </Action>
    <Action Name="CreateSilverlightBinFolder" Type="CreateFolderAction">
      <Input Name="FullPath" RecipeArgument="SilverlightBinFolder"/>
    </Action>

    <!-- Creates SharedBinaries folders-->
    <Action Name="CreateSharedBinariesFolder" Type="CreateFolderAction">
      <Input Name="FullPath" RecipeArgument="SharedBinariesFolder"/>
    </Action>
    <Action Name="CreatePrismBinariesFolderWpf" Type="CreateFolderAction">
      <Input Name="FullPath" RecipeArgument="PrismBinariesFolderWpf"/>
    </Action>
    <Action Name="CreatePrismBinariesFolderSilverlight" Type="CreateFolderAction">
      <Input Name="FullPath" RecipeArgument="PrismBinariesFolderSilverlight"/>
    </Action>
    <Action Name="CreateMicrosoftBinariesFolder" Type="CreateFolderAction">
      <Input Name="FullPath" RecipeArgument="MicrosoftBinariesFolder"/>
    </Action>
    <Action Name="CreateEntlibBinariesFolder" Type="CreateFolderAction">
      <Input Name="FullPath" RecipeArgument="EntlibBinariesFolder"/>
    </Action>

    <!-- Copies assemblies to SharedBinaries -->
    <Action Name="CopyPrismDllsForDesktop" Type="FileCopyAction">
      <Input Name="FileNames" RecipeArgument="PrismAssembliesWpf"/>
      <Input Name="SourceDir" RecipeArgument="PrismAssembliesPathWpf"/>
      <Input Name="TargetDir" RecipeArgument="PrismBinariesFolderWpf"/>
    </Action>

    <Action Name="CopyPrismDllsForSilverlight" Type="FileCopyAction">
      <Input Name="FileNames" RecipeArgument="PrismAssembliesSilverlight"/>
      <Input Name="SourceDir" RecipeArgument="PrismAssembliesPathSilverlight"/>
      <Input Name="TargetDir" RecipeArgument="PrismBinariesFolderSilverlight"/>
    </Action>

    <Action Name="CopyEntlibDlls" Type="FileCopyAction">
      <Input Name="SourceDir" RecipeArgument="EntlibAssembliesPath"/>
      <Input Name="TargetDir" RecipeArgument="EntlibBinariesFolder"/>
    </Action>

    <!--Compose assembly files to be referenced-->
    <Action Name="MicrosoftPracticesCompositeAssemblyFileWpf" Type="EvaluateExpressionAction" Expression="$(LibPath)\$(Assembly)">
      <Input Name="LibPath" RecipeArgument="PrismBinariesFolderWpf" />
      <Input Name="Assembly" RecipeArgument="MicrosoftPracticesCompositeAssembly" />
      <Output Name="ReturnValue"/>
    </Action>
    <Action Name="MicrosoftPracticesCompositePresentationAssemblyFileWpf" Type="EvaluateExpressionAction" Expression="$(LibPath)\$(Assembly)">
      <Input Name="LibPath" RecipeArgument="PrismBinariesFolderWpf" />
      <Input Name="Assembly" RecipeArgument="MicrosoftPracticesCompositePresentationAssembly" />
      <Output Name="ReturnValue"/>
    </Action>
    <Action Name="MicrosoftPracticesUnityAssemblyFileWpf" Type="EvaluateExpressionAction" Expression="$(LibPath)\$(Assembly)">
      <Input Name="LibPath" RecipeArgument="PrismBinariesFolderWpf" />
      <Input Name="Assembly" RecipeArgument="MicrosoftPracticesUnityAssemblyWpf" />
      <Output Name="ReturnValue"/>
    </Action>
    <Action Name="MicrosoftPracticesUnityExtensionsAssemblyFileWpf" Type="EvaluateExpressionAction" Expression="$(LibPath)\$(Assembly)">
      <Input Name="LibPath" RecipeArgument="PrismBinariesFolderWpf" />
      <Input Name="Assembly" RecipeArgument="MicrosoftPracticesUnityExtensionsAssembly" />
      <Output Name="ReturnValue"/>
    </Action>

    <!--Add project references-->
    <Action Name="AddInfrastrucureProjectReferenceToShellWpf" Type="AddProjectReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellProjectWpf" />
      <Input Name="ReferencedProject" RecipeArgument="InfrastructureProjectWpf" />
    </Action>

    <Action Name="AddShellProjectReferenceToShellTestWpf" Type="AddProjectReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellTestProjectWpf" />
      <Input Name="ReferencedProject" RecipeArgument="ShellProjectWpf" />
    </Action>
    <Action Name="AddInfrastructureProjectReferenceToShellTestWpf" Type="AddProjectReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellTestProjectWpf" />
      <Input Name="ReferencedProject" RecipeArgument="InfrastructureProjectWpf" />
    </Action>

    <Action Name="AddInfrastructureProjectReferenceTofrastructureTestWpf" Type="AddProjectReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="InfrastructureTestProjectWpf" />
      <Input Name="ReferencedProject" RecipeArgument="InfrastructureProjectWpf" />
    </Action>


    <!--Add assembly references-->
    <Action Name="AddPrismReference1ToShellProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesCompositeAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference2ToShellProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesCompositePresentationAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference3ToShellProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesUnityAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference4ToShellProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesUnityExtensionsAssemblyFileWpf.ReturnValue" />
    </Action>

    <Action Name="AddPrismReference1ToInfrastructureProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="InfrastructureProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesCompositeAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference2ToInfrastructureProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="InfrastructureProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesCompositePresentationAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference3ToInfrastructureProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="InfrastructureProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesUnityAssemblyFileWpf.ReturnValue" />
    </Action>

    <Action Name="AddPrismReference1ToShellTestProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellTestProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesCompositeAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference2ToShellTestProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellTestProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesCompositePresentationAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference3ToShellTestProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellTestProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesUnityAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference4ToShellTestProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="ShellTestProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesUnityExtensionsAssemblyFileWpf.ReturnValue" />
    </Action>

    <Action Name="AddPrismReference1ToInfrastructureTestProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="InfrastructureTestProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesCompositeAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference2ToInfrastructureTestProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="InfrastructureTestProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesCompositePresentationAssemblyFileWpf.ReturnValue" />
    </Action>
    <Action Name="AddPrismReference3ToInfrastructureTestProjectWpf" Type="AddAssemblyReferenceAction">
      <Input Name="ReferringProject" RecipeArgument="InfrastructureTestProjectWpf" />
      <Input Name="AssemblyFilePath" ActionOutput="MicrosoftPracticesUnityAssemblyFileWpf.ReturnValue" />
    </Action>

    <!--Sets Shell as Startup Project-->
    <Action Name="SetStartupProjectAction" Type="SetStartupProjectAction">
      <Input Name="Project" RecipeArgument="ShellProjectWpf"/>
    </Action>

    <!--Saves the RootNamespace in the global variables of the solution-->
    <Action Name="SaveRootNamespace" Type="SetGlobalValueAction" PersistValue="true" GlobalVariableName="RootNamespace">
      <Input Name="Value" RecipeArgument="RootNamespace"/>
    </Action>

    <!--Saves projects GUIDS in the global variables of the solution-->
    <Action Name="GetShellProjectGuid" Type="GetProjectGuidAction">
      <Input Name="Project" RecipeArgument="ShellProjectWpf"/>
      <Output Name="Guid"/>
    </Action>
    <Action Name="SaveShellProjectGuid" Type="SetGlobalValueAction" PersistValue="true" GlobalVariableName="ShellProjectGuid">
      <Input Name="Value" ActionOutput="GetShellProjectGuid.Guid"/>
    </Action>
    <Action Name="GetInfrastructureProjectGuid" Type="GetProjectGuidAction">
      <Input Name="Project" RecipeArgument="InfrastructureProjectWpf"/>
      <Output Name="Guid"/>
    </Action>
    <Action Name="SaveInfrastructureProjectGuid" Type="SetGlobalValueAction" PersistValue="true" GlobalVariableName="InfrastructureProjectGuid">
      <Input Name="Value" ActionOutput="GetInfrastructureProjectGuid.Guid"/>
    </Action>
    
    <!--Compiles the solution-->
    <Action Name="CompileSolution" Type="CompileSolutionAction" />

  </Actions>
</Recipe>
